﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="collaboration_type_index.aspx.cs" Inherits="Ccit.Mgoa.Collaboration.collaboration_type_index" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v8.1" Namespace="DevExpress.Web.ASPxGridView"
    TagPrefix="dxwgv" %>
<%@ Register TagPrefix="ccit" Namespace="Ccit.ServerControls" Assembly="Ccit.ServerControls.ActionForm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>协作管理-协作类型列表</title>
    <script language="javascript" type="text/javascript" src="../script/jbase64.js"></script>
    <script language="javascript" type="text/javascript">
    <!--
        /* Edit CollaborativeType */
        function doEdit(oTypeId)
        {
            var oParam="id="+oTypeId;
            var oEncodeParam=base64encode(oParam);
            window.location.href="collaboration_type_edit.aspx?"+oEncodeParam;
        }
        
        /* Delete CollaborativeTypes */
        function doDelete(oTypeId)
        {
            if(oTypeId=="")
            {
                oTypeId=document.getElementById("hdTypeId").value;
                if(oTypeId=="")
                {
                    alert("请选择要删除的协作类型！");
                    return;
                }
                else if(confirm("确实要删除选择的协作类型？"))
                    PageMethods.DeleteCollaborativeType(oTypeId,ClientCallBack);
            }
            else
            {
                if(confirm("确实要删除该协作类型？"))
                    PageMethods.DeleteCollaborativeType(oTypeId,ClientCallBack);
            }
        }
        
        function ClientCallBack(oResult)
        {
            if(oResult)
            {
                alert("协作类型删除成功！")
                __doPostBack("lnkRefresh","");
            }
            else
            {
                alert("协作类型删除失败！")
            }
        }
        
    //-->
    </script>
</head>
<body>
    <ccit:ActionForm id="form1" runat="server">
        <input type="hidden" id="hdTypeId" runat="server" />
        <asp:LinkButton ID="lnkRefresh" runat="server" style="display:none" onclick="lnkRefresh_Click"></asp:LinkButton>
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"></asp:ScriptManager>
        <table border="0" cellpadding="0" cellspacing="0" align="center" width="98%" class="tbToolbar">
            <tr>
                <td align="left">
                    <div class="tbSeparator"></div>
                </td>
                <td align="left" class="titlebar" style="width:100%">
                    <nobr>
                        协作空间-协作类型管理
                    </nobr>
                </td>
                <td align="right">
                    <div class="tbSeparator"></div>
                </td>
                <td>
                    <nobr>
                        <a href="javascript:doEdit('')" class="linktext" runat="server">
                            <img src="../images/toolbar/new.gif" />新增
                        </a>
                        <a href="javascript:doDelete('')" class="linktext" runat="server">
                            <img src="../images/toolbar/delete.gif" />删除
                        </a>
                    </nobr>
                </td>
                <td align="right">
                    <div class="tbSeparatorEnd"></div>
                </td>
            </tr>
        </table>
        <dxwgv:ASPxGridView ID="gvCollaborationTypeList" runat="server" Width="98%" 
            KeyFieldName="TypeId" align="center" 
            onhtmlrowcreated="gvCollaborationTypeList_HtmlRowCreated">
            <SettingsPager AlwaysShowPager="True" PageSize="15">
                <FirstPageButton Visible="True">
                </FirstPageButton>
                <LastPageButton Visible="True">
                </LastPageButton>
            </SettingsPager>
            <Styles>
                <Row CssClass=""></Row>
                <AlternatingRow  CssClass="" Enabled="true"/>
                <SelectedRow  CssClass=""></SelectedRow>                
            </Styles>
            <Settings ShowFilterRow="false" ShowPreview="True"/>
            <SettingsBehavior ColumnResizeMode="Control" />
            <SettingsCustomizationWindow Enabled="true" />
            <Columns>
                <dxwgv:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0" Width="3%">
                    <HeaderTemplate>
                        <input id="Checkbox1" type="checkbox" runat="server" onclick="gvCollaborationTypeList.SelectAllRowsOnPage(this.checked);" style="vertical-align:middle;" title="Select/Unselect all rows on the page"></input>
                    </HeaderTemplate>
                    <HeaderStyle Paddings-PaddingTop="1" Paddings-PaddingBottom="1" HorizontalAlign="Center">
                        <Paddings PaddingTop="1px" PaddingBottom="1px"></Paddings>
                     </HeaderStyle>
                </dxwgv:GridViewCommandColumn>
                <dxwgv:GridViewDataTextColumn Caption="类型名称" Width="15%" VisibleIndex="1" FieldName="TypeName">
                    <HeaderStyle HorizontalAlign="Center" />
                    <CellStyle HorizontalAlign="Center"></CellStyle>
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="类型描述" Width="43%" VisibleIndex="2" FieldName="TypeDesc">
                    <HeaderStyle HorizontalAlign="Center" />
                    <CellStyle HorizontalAlign="Center" Wrap="False"></CellStyle>
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="创建人" Width="12%" VisibleIndex="3" FieldName="Creator">
                    <HeaderStyle HorizontalAlign="Center" />
                    <CellStyle HorizontalAlign="Center"></CellStyle>
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="创建时间" Width="17%" VisibleIndex="4" FieldName="CreateDate">
                    <HeaderStyle HorizontalAlign="Center" />
                    <CellStyle HorizontalAlign="Center" Wrap="False"></CellStyle>
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="操作" VisibleIndex="6" Width="10%">
                    <HeaderStyle HorizontalAlign="Center" />
                    <CellStyle HorizontalAlign="Center"></CellStyle>
                    <DataItemTemplate>
                        <a id="haEdit" runat="server">编辑</a>
                        <a id="haDelete" runat="server">删除</a>
                    </DataItemTemplate>
                </dxwgv:GridViewDataTextColumn>
            </Columns>
            <ClientSideEvents SelectionChanged="function(s,e){OnGridSelectionChanged();}"/>
        </dxwgv:ASPxGridView>
    </ccit:ActionForm>
    <script language="javascript" type="text/javascript">
        <!--
        function OnGridSelectionChanged(){           
            gvCollaborationTypeList.GetSelectedFieldValues("TypeId",OnGridSelectionComplete);
        }
        
        function OnGridSelectionComplete(values){
            document.getElementById("hdTypeId").value = values;
        }
        //-->
    </script>
</body>
</html>
